package com.jwthhealth_pub.old.api;

import com.jwthhealth_pub.common.MD5Util;

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;

public class ReqUtil {
    public static String getSign(HashMap<String, String> map, String token){

        ArrayList<String> _list = new ArrayList<>();
        for (String key: map.keySet()) {
            _list.add(key);
        }

        Collections.sort(_list);
        Collections.reverse(_list);

        StringBuffer _sign = new StringBuffer();
        String _token = "";
        for (int i=0; i<_list.size(); i++) {
            String key = _list.get(i);
            _sign.append(map.get(key));
            if (key.equals("uid"))
                _token = token;
        }

        _sign.append(_token);

        return MD5Util.getMD5(String.valueOf(_sign));
    }
}
